package com.ea.eadp.nexus.test.pageDefinition.originX;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import com.ea.eadp.nexus.test.common.PageOperation;
import com.ea.eadp.nexus.test.pageDefinition.BasePage;

public class PrivacySettingsPage extends BasePage {

    private static final String NEXT_BUTTON_ID = "nextBtn";
    private static final String SECURITY_QUESTION_ID = "securityQuestion";
    private static final String SECURITY_ANSWER_ID = "securityAnswer";
    private static final String FRIEND_VISIBILITY_ID = "clientreg_friend_visibility";
    private static final String TITLE_ID = "privacySettings";

    public PrivacySettingsPage(WebDriver driver) {
        super(driver, PrivacySettingsPage.class);
    }

    public void waitSQPageLoadCompleted() {
        PageOperation.WebDriverWait(driver, SECURITY_QUESTION_ID);
    }

    public void waitPSPageLoadCompleted() {
        PageOperation.WebDriverWait(driver, FRIEND_VISIBILITY_ID);
    }

    public void setProfileViewedBy(final ViewedBy viewedBy) {

    }

    public void allowFindMeByEmail(final Boolean checked) {

    }

    public void allowViewMyActivities(final Boolean checked) {

    }

    public void emailMe(final Boolean checked) {

    }

    public void setSecurityQuestion(final int question) {
        driver.switchTo().window(operationWindowHandle);
        driver.findElement(By.id(SECURITY_QUESTION_ID)).click();
        String XPath = String.format("//select[@id='%s']/option[%s]", SECURITY_QUESTION_ID, String.valueOf(question));
        driver.findElement(By.xpath(XPath)).click();
    }

    public void setSecurtiyQuestionAnswer(final String answer) {
        driver.switchTo().window(operationWindowHandle);
        log.info(answer);
        PageOperation.SendKeyToElementAfterWait(driver, SECURITY_ANSWER_ID, answer);
    }

    public void clickNextButton() {
        driver.findElement(By.id(NEXT_BUTTON_ID)).click();
    }

    public enum ViewedBy {
        EveryOne,
        Friends,
        FriendsOfFriends,
        NoOne
    }
}